<?php
	$id=(isset($_GET['id']))?$_GET['id']:0;
	require 'lj.php';
	if(empty($_POST)){
		$sql="select * from t_message where id={$id}";
		$result=$db->query($sql);
		$q=$result->fetch_array();
		include 'xg.php';
	}else{
		$username=$_REQUEST['username'];
	    $message=$_REQUEST['message'];
	    $sql="update t_message set username='{$username}',message='{$message}' where id={$id}";
		$rs=$db->query($sql);
		if ($rs==true){
		    header("location:index.php");
		}else{
		    echo "<script language='javascript'>";
		    echo "alert('留言删除失败！');";
		    echo "window.location.herf='index.php';";
		    echo "</script>";
		}
	}
	$db->close();